//
//  WBWebViewController.swift
//  Weibo
//
//  Created by cc on 11/3/17.
//  Copyright © 2017 cc. All rights reserved.
//

import UIKit


/// 网页控制器
class WBWebViewController: WBBaseViewController {
    private lazy var webView = UIWebView(frame: UIScreen.main.bounds)
    

    /// 要 加载的url字符串
    var urlString: String? {
        didSet {
            guard let urlString = urlString, let url = URL(string: urlString) else {
                return
            }
            webView.loadRequest(URLRequest(url: url))
        }
    }
}

extension WBWebViewController {
    override func setupTableView() {
        
        //设置标题
        navItem.title = "网页"
        
        // 设置webView
        view.insertSubview(webView, belowSubview: navigationBar)
        
        webView.backgroundColor = UIColor.white
        
        //设置 contentInset
        webView.scrollView.contentInset.top = navigationBar.bounds.height
    }
}
